package com.dq.stream.test;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.util.JSONPObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.HashMap;
import java.util.Map;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
//@SpringBootApplication(scanBasePackageClasses = StreamTestApplication.class)
//@WebAppConfiguration
public class test {
    @Autowired
    @Qualifier("input")
    private MessageChannel input;

    @Test
    public void test() {

        JSONPObject object = new JSONPObject("ssss", "343434");
        input.send(MessageBuilder.withPayload("{\"name\":\"dq\",\"age\":99}").build());
//        Map<String,String> payload =  new HashMap();
//        payload.put("\"sss\"","\"你是大莎草\"");
//        payload.put("\"ssss\"","\"sdssss\"");
//        Map<String,Object> headers = new HashMap();
//        headers.put("heaa","saasas");
//        input.send(new GenericMessage<>(payload, headers));
    }
}
